import { Button } from "antd"
import React from "react"

const globalEvent = window.myEven
class B extends React.Component {
  state = {
    newParams: ""
  }

  handdler = (params) => {
    this.setState({
      newParams: params
    })
  }

  bindhanddler = () => {
    globalEvent.on("someEvent", this.handdler)
  }

  render() {
    return (
      <div>
        <Button onClick={this.bindhanddler}>点我监听A的动作</Button>
        <h4>A传入的内容是:{this.state.newParams}</h4>
      </div>
    )
  }
}


export default B